package com.ks.config.starter;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@Configuration
@EnableFeignClients(basePackages = "com.ks.config")
@EnableDiscoveryClient
@MapperScan("com.ks.config.dao")
@SpringBootApplication(scanBasePackages = {"com.ks.config"})
public class ApplicationStarter extends WebMvcConfigurerAdapter {

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(ApplicationStarter.class);
        AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
        app.setBannerMode(Banner.Mode.CONSOLE);
        app.run(args);
    }
}
